home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 26 / Cream of the Crop 26.iso / doom / suckmods.zip / SUCKMODS.ZIP / suck05 / src / items.qc < prev    next >
Text File  |  1997-05-13  |  31KB  |  1,467 lines

  1. void(entity e, float chan, string samp, float vol, float atten) playsound;
  2. void() W_SetCurrentAmmo;
  3. /* ALL LIGHTS SHOULD BE 0 1 0 IN COLOR ALL OTHER ITEMS SHOULD
  4. BE .8 .3 .4 IN COLOR */
  5. void() RuneGrab;
  6. void() InitRune;
  7. void() SpawnRunes;
  8.  
  9. void() SUB_regen =
  10. {
  11.     self.model = self.mdl;        // restore original model
  12.     self.solid = SOLID_TRIGGER;    // allow it to be touched again
  13.     playsound (self, CHAN_VOICE, "items/itembk2.wav", 1, ATTN_NORM);    // play respawn sound
  14.     setorigin (self, self.origin);
  15. };
  16.  
  17.  
  18.  
  19. /*QUAKED noclass (0 0 0) (-8 -8 -8) (8 8 8)
  20. prints a warning message when spawned
  21. */
  22. void() noclass =
  23. {
  24.     dprint ("noclass spawned at");
  25.     dprint (vtos(self.origin));
  26.     dprint ("\n");
  27.     remove (self);
  28. };
  29.  
  30.  
  31.  
  32. /*
  33. ============
  34. PlaceItem
  35.  
  36. plants the object on the floor
  37. ============
  38. */
  39. void() PlaceItem =
  40. {
  41.     local float    oldz;
  42.  
  43.     self.mdl = self.model;        // so it can be restored on respawn
  44.     self.flags = FL_ITEM;        // make extra wide
  45.     self.solid = SOLID_TRIGGER;
  46.     self.movetype = MOVETYPE_TOSS;    
  47.     self.velocity = '0 0 0';
  48.     self.origin_z = self.origin_z + 6;
  49.     oldz = self.origin_z;
  50.     if (!droptofloor())
  51.     {
  52.         dprint ("Bonus item fell out of level at ");
  53.         dprint (vtos(self.origin));
  54.         dprint ("\n");
  55.         remove(self);
  56.         return;
  57.     }
  58. };
  59.  
  60. /*
  61. ============
  62. StartItem
  63.  
  64. Sets the clipping size and plants the object on the floor
  65. ============
  66. */
  67. void() StartItem =
  68. {
  69.     self.nextthink = time + 0.2;    // items start after other solids
  70.     self.think = PlaceItem;
  71. };
  72.  
  73. /*
  74. =========================================================================
  75.  
  76. HEALTH BOX
  77.  
  78. =========================================================================
  79. */
  80. //
  81. // T_Heal: add health to an entity, limiting health to max_health
  82. // "ignore" will ignore max_health limit
  83. //
  84. float (entity e, float healamount, float ignore) T_Heal =
  85. {
  86.     if (e.health <= 0)
  87.         return 0;
  88.     if ((!ignore) && (e.health >= other.max_health))
  89.         return 0;
  90.     healamount = ceil(healamount);
  91.  
  92.     if ((e.rune_num == ITEM_RUNE_SARGON) && (healamount < 100))
  93.         healamount = healamount * 2;
  94.  
  95.     e.health = e.health + healamount;
  96.     if ((!ignore) && (e.health >= other.max_health))
  97.         e.health = other.max_health;
  98.         
  99.     if (e.health > 250)
  100.         e.health = 250;
  101.     return 1;
  102. };
  103.  
  104. /*QUAKED item_health (.3 .3 1) (0 0 0) (32 32 32) rotten megahealth
  105. Health box. Normally gives 25 points.
  106. Rotten box heals 5-10 points,
  107. megahealth will add 100 health, then 
  108. rot you down to your maximum health limit, 
  109. one point per second.
  110. */
  111.  
  112. float    H_ROTTEN = 1;
  113. float    H_MEGA = 2;
  114. .float    healamount, healtype;
  115. void() health_touch;
  116. void() item_megahealth_rot;
  117.  
  118. void() item_health =
  119. {    
  120.     self.touch = health_touch;
  121.  
  122.     if (self.spawnflags & H_ROTTEN)
  123.     {
  124.         precache_model("maps/b_bh10.bsp");
  125.  
  126.         precache_sound("items/r_item1.wav");
  127.         setmodel(self, "maps/b_bh10.bsp");
  128.         self.noise = "items/r_item1.wav";
  129.         self.healamount = 15;
  130.         self.healtype = 0;
  131.     }
  132.     else
  133.     if (self.spawnflags & H_MEGA)
  134.     {
  135.         precache_model("maps/b_bh100.bsp");
  136.         precache_sound("items/r_item2.wav");
  137.         setmodel(self, "maps/b_bh100.bsp");
  138.         self.noise = "items/r_item2.wav";
  139.         self.healamount = 100;
  140.         self.healtype = 2;
  141.     }
  142.     else
  143.     {
  144.         precache_model("maps/b_bh25.bsp");
  145.         precache_sound("items/health1.wav");
  146.         setmodel(self, "maps/b_bh25.bsp");
  147.         self.noise = "items/health1.wav";
  148.         self.healamount = 25;
  149.         self.healtype = 1;
  150.     }
  151.     setsize (self, '0 0 0', '32 32 56');
  152.     StartItem ();
  153. };
  154.  
  155.  
  156. void() health_touch =
  157. {
  158.     local    float amount;
  159.     local    string    s;
  160.     
  161.     if (other.classname != "player")
  162.         return;
  163.     
  164.     if (self.healtype == 2) // Megahealth?  Ignore max_health...
  165.     {
  166.         if (other.health >= 250)
  167.             return;
  168.         if (!T_Heal(other, self.healamount, 1))
  169.             return;
  170.     }
  171.     else
  172.     {
  173.         if (!T_Heal(other, self.healamount, 0))
  174.             return;
  175.     }
  176.     
  177. // ZOID--remove uncessary msgs
  178.     if (!deathmatch) {
  179.         sprint(other, "You receive ");
  180.         s = ftos(self.healamount);
  181.         sprint(other, s);
  182.         sprint(other, " health\n");
  183.     }
  184.     
  185. // health touch sound
  186.     playsound(other, CHAN_ITEM, self.noise, 1, ATTN_NORM);
  187.  
  188.     stuffcmd (other, "bf\n");
  189.     
  190.     self.model = string_null;
  191.     self.solid = SOLID_NOT;
  192.  
  193.     // Megahealth = rot down the player's super health
  194.     if (self.healtype == 2)
  195.     {
  196.         other.items = other.items | IT_SUPERHEALTH;
  197.         self.nextthink = time + 5;
  198.         self.think = item_megahealth_rot;
  199.         self.owner = other;
  200.     }
  201.     else
  202.     {
  203.         if (deathmatch != 2)        // deathmatch 2 is the silly old rules
  204.         {
  205.             if (deathmatch)
  206.                 self.nextthink = time + 20;
  207.             self.think = SUB_regen;
  208.         }
  209.     }
  210.     
  211.     activator = other;
  212.     SUB_UseTargets();                // fire all targets / killtargets
  213. };    
  214.  
  215. void() item_megahealth_rot =
  216. {
  217.     other = self.owner;
  218.     
  219. //ZOID: player doesn't rot if they have Elder Magic rune
  220.     if (other.health > other.max_health && 
  221.         !(other.rune_num == ITEM_RUNE_REGEN)) {
  222.         other.health = other.health - 1;
  223.         self.nextthink = time + 1;
  224.         return;
  225.     }
  226.  
  227. // it is possible for a player to die and respawn between rots, so don't
  228. // just blindly subtract the flag off
  229.     other.items = other.items - (other.items & IT_SUPERHEALTH);
  230.     
  231.     if (deathmatch == 1 || deathmatch == 3)    // deathmatch 2 is silly old rules
  232.     {
  233.         self.nextthink = time + 20;
  234.         self.think = SUB_regen;
  235.     }
  236. };
  237.  
  238. /*
  239. ===============================================================================
  240.  
  241. ARMOR
  242.  
  243. ===============================================================================
  244. */
  245.  
  246. void() armor_touch;
  247.  
  248. void() armor_touch =
  249. {
  250.     local    float    type, value, bit;
  251.     
  252.     if (other.health <= 0)
  253.         return;
  254.     if (other.classname != "player")
  255.         return;
  256.  
  257.     if ((other.rune_num == ITEM_RUNE_WEREWOLF) ||
  258.         (other.rune_num == ITEM_RUNE_SAMURAI))
  259.         return;
  260.     if (self.classname == "item_armor1")
  261.     {
  262.         type = 0.3;
  263.         value = 100;
  264.         bit = IT_ARMOR1;
  265.     }
  266.     if (self.classname == "item_armor2")
  267.     {
  268.         type = 0.6;
  269.         value = 150;
  270.         bit = IT_ARMOR2;
  271.     }
  272.     if (self.classname == "item_armorInv")
  273.     {
  274.         type = 0.8;
  275.         value = 200;
  276.         bit = IT_ARMOR3;
  277.     }
  278.  
  279.     if (other.armortype*other.armorvalue >= type*value)
  280.         return;
  281.  
  282.     // SUCK: Hermes cannot hold as much armor - it weighs him down.
  283.     if (other.rune_num == ITEM_RUNE_HERMES)
  284.         value = value / 2;
  285.  
  286.     other.armortype = type;
  287.     other.armorvalue = value;
  288.     other.items = other.items - (other.items & (IT_ARMOR1 | IT_ARMOR2 | IT_ARMOR3)) + bit;
  289.  
  290.     self.solid = SOLID_NOT;
  291.     self.model = string_null;
  292.     if (deathmatch == 1 || deathmatch == 3)
  293.         self.nextthink = time + 20;
  294.     self.think = SUB_regen;
  295.  
  296. //ZOID--remove unneccessary msgs
  297.     if (!deathmatch)
  298.         sprint(other, "You got armor\n");
  299. // armor touch sound
  300.     playsound(other, CHAN_ITEM, "items/armor1.wav", 1, ATTN_NORM);
  301.     stuffcmd (other, "bf\n");
  302.     
  303.     activator = other;
  304.     SUB_UseTargets();                // fire all targets / killtargets
  305. };
  306.  
  307.  
  308. /*QUAKED item_armor1 (0 .5 .8) (-16 -16 0) (16 16 32)
  309. */
  310.  
  311. void() item_armor1 =
  312. {
  313.     self.touch = armor_touch;
  314.     precache_model ("progs/armor.mdl");
  315.     setmodel (self, "progs/armor.mdl");
  316.     self.skin = 0;
  317.     setsize (self, '-16 -16 0', '16 16 56');
  318.     StartItem ();
  319. };
  320.  
  321. /*QUAKED item_armor2 (0 .5 .8) (-16 -16 0) (16 16 32)
  322. */
  323.  
  324. void() item_armor2 =
  325. {
  326.     self.touch = armor_touch;
  327.     precache_model ("progs/armor.mdl");
  328.     setmodel (self, "progs/armor.mdl");
  329.     self.skin = 1;
  330.     setsize (self, '-16 -16 0', '16 16 56');
  331.     StartItem ();
  332. };
  333.  
  334. /*QUAKED item_armorInv (0 .5 .8) (-16 -16 0) (16 16 32)
  335. */
  336.  
  337. void() item_armorInv =
  338. {
  339.     self.touch = armor_touch;
  340.     precache_model ("progs/armor.mdl");
  341.     setmodel (self, "progs/armor.mdl");
  342.     self.skin = 2;
  343.     setsize (self, '-16 -16 0', '16 16 56');
  344.     StartItem ();
  345. };
  346.  
  347. /*
  348. ===============================================================================
  349.  
  350. WEAPONS
  351.  
  352. ===============================================================================
  353. */
  354.  
  355. void() bound_other_ammo =
  356. {
  357.     if (other.ammo_shells > 100)
  358.         other.ammo_shells = 100;
  359.     if (other.ammo_nails > 200)
  360.         other.ammo_nails = 200;
  361.     if (other.ammo_rockets > 100)
  362.         other.ammo_rockets = 100;        
  363.     if (other.ammo_cells > 100)
  364.         other.ammo_cells = 100;        
  365. };
  366.  
  367.  
  368. float(float w) RankForWeapon =
  369. {
  370.     if (w == IT_LIGHTNING)
  371.         return 1;
  372.     if (w == IT_ROCKET_LAUNCHER)
  373.         return 2;
  374.     if (w == IT_SUPER_NAILGUN)
  375.         return 3;
  376.     if (w == IT_GRENADE_LAUNCHER)
  377.         return 4;
  378.     if (w == IT_SUPER_SHOTGUN)
  379.         return 5;
  380.     if (w == IT_NAILGUN)
  381.         return 6;
  382.     return 7;
  383. };
  384.  
  385. /*
  386. =============
  387. Deathmatch_Weapon
  388.  
  389. Deathmatch weapon change rules for picking up a weapon
  390.  
  391. .float        ammo_shells, ammo_nails, ammo_rockets, ammo_cells;
  392. =============
  393. */
  394. void(float old, float new) Deathmatch_Weapon =
  395. {
  396.     local float or, nr;
  397.  
  398. // change self.weapon if desired
  399.     if (self.weapon == IT_HOOK && self.button0)
  400.         return; // never change if we pulled ourselves to it.
  401.     or = RankForWeapon (self.weapon);
  402.     nr = RankForWeapon (new);
  403.     if ( nr < or )
  404.         self.weapon = new;
  405. };
  406.  
  407. /*
  408. =============
  409. weapon_touch
  410. =============
  411. */
  412. float() W_BestWeapon;
  413.  
  414. void() weapon_touch =
  415. {
  416.     local    float    hadammo, best, new, old;
  417.     local    entity    stemp;
  418.     local    float    leave;
  419. //McBain: added prevweapon local variable
  420.     local    float    prevweapon;
  421.  
  422.     if (!(other.flags & FL_CLIENT))
  423.         return;
  424.  
  425. // if the player was using his best weapon, change up to the new one if better        
  426.     stemp = self;
  427.     self = other;
  428.     best = W_BestWeapon();
  429.     self = stemp;
  430.  
  431.     if (deathmatch == 2 || deathmatch == 3 || coop)
  432.         leave = 1;
  433.     else
  434.         leave = 0;
  435.  
  436.     if ((other.rune_num == ITEM_RUNE_MONK) ||
  437.         (other.rune_num == ITEM_RUNE_VIKING))
  438.         leave = 1;
  439.  
  440.     if (self.classname == "weapon_nailgun")
  441.     {
  442.         if (leave && (other.items & IT_NAILGUN) )
  443.             return;
  444.         hadammo = other.ammo_nails;            
  445.         new = IT_NAILGUN;
  446. // *TEAMPLAY*
  447.         if ( !( coop && (teamplay & TEAM_DROP_ITEMS)))
  448.             other.ammo_nails = other.ammo_nails + 30;
  449.     }
  450.     else if (self.classname == "weapon_supernailgun")
  451.     {
  452.         if (leave && (other.items & IT_SUPER_NAILGUN) )
  453.             return;
  454.         hadammo = other.ammo_rockets;            
  455.         new = IT_SUPER_NAILGUN;
  456. // *TEAMPLAY*
  457.         if ( !( coop && (teamplay & TEAM_DROP_ITEMS) ) ) {
  458.             other.ammo_nails = other.ammo_nails + 30;
  459.         }
  460.     }
  461.     else if (self.classname == "weapon_supershotgun")
  462.     {
  463.         if (leave && (other.items & IT_SUPER_SHOTGUN) )
  464.             return;
  465.         hadammo = other.ammo_rockets;            
  466.         new = IT_SUPER_SHOTGUN;
  467. // *TEAMPLAY*
  468.         if ( !( coop && (teamplay & TEAM_DROP_ITEMS) ) )
  469.             other.ammo_shells = other.ammo_shells + 5;
  470.     }
  471.     else if (self.classname == "weapon_rocketlauncher")
  472.     {
  473.         if (other.rune_num == ITEM_RUNE_GOLOM)
  474.             return;
  475.         if (leave && (other.items & IT_ROCKET_LAUNCHER) )
  476.             return;
  477.         hadammo = other.ammo_rockets;            
  478.         new = IT_ROCKET_LAUNCHER;
  479. // *TEAMPLAY*
  480.         if ( !( coop && (teamplay & TEAM_DROP_ITEMS) ) )
  481.             other.ammo_rockets = other.ammo_rockets + 5;
  482.     }
  483.     else if (self.classname == "weapon_grenadelauncher")
  484.     {
  485.         if (other.rune_num == ITEM_RUNE_GOLOM)
  486.             return;
  487.         if (leave && (other.items & IT_GRENADE_LAUNCHER) )
  488.             return;
  489.         hadammo = other.ammo_rockets;            
  490.         new = IT_GRENADE_LAUNCHER;
  491. // *TEAMPLAY*
  492.         if ( !( coop && (teamplay & TEAM_DROP_ITEMS) ) )
  493.             other.ammo_rockets = other.ammo_rockets + 5;
  494.     }
  495.     else if (self.classname == "weapon_lightning")
  496.     {
  497.         if (other.rune_num == ITEM_RUNE_POSEIDON)
  498.             return;
  499.         if (leave && (other.items & IT_LIGHTNING) )
  500.             return;
  501.         hadammo = other.ammo_rockets;            
  502.         new = IT_LIGHTNING;
  503. // *TEAMPLAY*
  504.         if ( !( coop && (teamplay & TEAM_DROP_ITEMS) ) )
  505.             other.ammo_cells = other.ammo_cells + 15;
  506.     }
  507.     else
  508.         objerror ("weapon_touch: unknown classname");
  509.  
  510. //ZOID--remove unnessary msgs
  511.     if (!deathmatch) {
  512.         sprint (other, "You got the ");
  513.         sprint (other, self.netname);
  514.         sprint (other, "\n");
  515.     }
  516.  
  517. // weapon touch sound
  518.     playsound (other, CHAN_ITEM, "weapons/pkup.wav", 1, ATTN_NORM);
  519.     stuffcmd (other, "bf\n");
  520.  
  521.     bound_other_ammo ();
  522.  
  523. // change to the weapon
  524.     old = other.items;
  525.     other.items = other.items | new;
  526.     
  527.     stemp = self;
  528.     self = other;
  529.  
  530. //McBain: temp store old weapon
  531.     prevweapon = self.weapon; 
  532.  
  533.     if (!deathmatch)
  534.         self.weapon = new;
  535.     else
  536.         Deathmatch_Weapon (old, new);
  537.  
  538. //McBain: save previous weapon if different
  539.     if (self.weapon != prevweapon)
  540.         self.previous_weapon = prevweapon;
  541.  
  542.     W_SetCurrentAmmo();
  543.  
  544.     self = stemp;
  545.  
  546. /*    if (leave)
  547.         return; */
  548.  
  549. // remove it in single player, or setup for respawning in deathmatch
  550.     self.model = string_null;
  551.     self.solid = SOLID_NOT;
  552.     if (deathmatch == 1 || deathmatch == 3)
  553.         self.nextthink = time + 30;
  554.     self.think = SUB_regen;
  555.     
  556.     activator = other;
  557.     SUB_UseTargets();                // fire all targets / killtargets
  558. };
  559.  
  560.  
  561. /*QUAKED weapon_supershotgun (0 .5 .8) (-16 -16 0) (16 16 32)
  562. */
  563.  
  564. void() weapon_supershotgun =
  565. {
  566.     precache_model ("progs/g_shot.mdl");
  567.     setmodel (self, "progs/g_shot.mdl");
  568.     self.weapon = IT_SUPER_SHOTGUN;
  569.     self.netname = "Double-barrelled Shotgun";
  570.     self.touch = weapon_touch;
  571.     setsize (self, '-16 -16 0', '16 16 56');
  572.     StartItem ();
  573. };
  574.  
  575. /*QUAKED weapon_nailgun (0 .5 .8) (-16 -16 0) (16 16 32)
  576. */
  577.  
  578. void() weapon_nailgun =
  579. {
  580.     precache_model ("progs/g_nail.mdl");
  581.     setmodel (self, "progs/g_nail.mdl");
  582.     self.weapon = IT_NAILGUN;
  583.     self.netname = "nailgun";
  584.     self.touch = weapon_touch;
  585.     setsize (self, '-16 -16 0', '16 16 56');
  586.     StartItem ();
  587. };
  588.  
  589. /*QUAKED weapon_supernailgun (0 .5 .8) (-16 -16 0) (16 16 32)
  590. */
  591.  
  592. void() weapon_supernailgun =
  593. {
  594.     precache_model ("progs/g_nail2.mdl");
  595.     setmodel (self, "progs/g_nail2.mdl");
  596.     self.weapon = IT_SUPER_NAILGUN;
  597.     self.netname = "Super Nailgun";
  598.     self.touch = weapon_touch;
  599.     setsize (self, '-16 -16 0', '16 16 56');
  600.     StartItem ();
  601. };
  602.  
  603. /*QUAKED weapon_grenadelauncher (0 .5 .8) (-16 -16 0) (16 16 32)
  604. */
  605.  
  606. void() weapon_grenadelauncher =
  607. {
  608.     precache_model ("progs/g_rock.mdl");
  609.     setmodel (self, "progs/g_rock.mdl");
  610.     self.weapon = 3;
  611.     self.netname = "Grenade Launcher";
  612.     self.touch = weapon_touch;
  613.     setsize (self, '-16 -16 0', '16 16 56');
  614.     StartItem ();
  615. };
  616.  
  617. /*QUAKED weapon_rocketlauncher (0 .5 .8) (-16 -16 0) (16 16 32)
  618. */
  619.  
  620. void() weapon_rocketlauncher =
  621. {
  622.     precache_model ("progs/g_rock2.mdl");
  623.     setmodel (self, "progs/g_rock2.mdl");
  624.     self.weapon = 3;
  625.     self.netname = "Rocket Launcher";
  626.     self.touch = weapon_touch;
  627.     setsize (self, '-16 -16 0', '16 16 56');
  628.     StartItem ();
  629. };
  630.  
  631.  
  632. /*QUAKED weapon_lightning (0 .5 .8) (-16 -16 0) (16 16 32)
  633. */
  634.  
  635. void() weapon_lightning =
  636. {
  637.     precache_model ("progs/g_light.mdl");
  638.     setmodel (self, "progs/g_light.mdl");
  639.     self.weapon = 3;
  640.     self.netname = "Thunderbolt";
  641.     self.touch = weapon_touch;
  642.     setsize (self, '-16 -16 0', '16 16 56');
  643.     StartItem ();
  644. };
  645.  
  646.  
  647. /*
  648. ===============================================================================
  649.  
  650. AMMO
  651.  
  652. ===============================================================================
  653. */
  654.  
  655. void() ammo_touch =
  656. {
  657. local entity    stemp;
  658. local float        best;
  659.  
  660.     if (other.classname != "player")
  661.         return;
  662.     if (other.health <= 0)
  663.         return;
  664.  
  665. // if the player was using his best weapon, change up to the new one if better        
  666.     stemp = self;
  667.  
  668.     self = other;
  669.     best = W_BestWeapon();
  670.     self = stemp;
  671. // shotgun
  672.  
  673.     if (self.weapon == 1)
  674.     {
  675.         if (other.ammo_shells >= 100)
  676.             return;
  677.         if (other.rune_num == ITEM_RUNE_SARGON)
  678.             other.ammo_shells = other.ammo_shells + 2*self.aflag;
  679.         else
  680.             other.ammo_shells = other.ammo_shells + self.aflag;
  681.     }
  682.  
  683. // spikes
  684.     if (self.weapon == 2)
  685.     {
  686.         if (other.ammo_nails >= 200)
  687.             return;
  688.         if (other.rune_num == ITEM_RUNE_SARGON)
  689.             other.ammo_nails = other.ammo_nails + 2*self.aflag;
  690.         else
  691.             other.ammo_nails = other.ammo_nails + self.aflag;
  692.     }
  693.  
  694. //    rockets
  695.     if (self.weapon == 3)
  696.     {
  697.         if (other.ammo_rockets >= 100)
  698.             return;
  699.         if (other.rune_num == ITEM_RUNE_SARGON)
  700.             other.ammo_rockets = other.ammo_rockets + 2*self.aflag;
  701.         else
  702.             other.ammo_rockets = other.ammo_rockets + self.aflag;
  703.     }
  704.  
  705. //    cells
  706.     if (self.weapon == 4)
  707.     {
  708.         if (other.ammo_cells >= 100)
  709.             return;
  710.         if (other.rune_num != ITEM_RUNE_POSEIDON)
  711.         {
  712.             if (other.rune_num == ITEM_RUNE_SARGON)
  713.                 other.ammo_cells = other.ammo_cells + 2*self.aflag;
  714.             else
  715.                 other.ammo_cells = other.ammo_cells + self.aflag;
  716.  
  717.         }
  718.     }
  719.  
  720.     bound_other_ammo ();
  721.     
  722. //ZOID--remove unnessary msgs
  723.     if (!deathmatch) {
  724.         sprint (other, "You got the ");
  725.         sprint (other, self.netname);
  726.         sprint (other, "\n");
  727.     }
  728. // ammo touch sound
  729.     playsound (other, CHAN_ITEM, "weapons/lock4.wav", 1, ATTN_NORM);
  730.     stuffcmd (other, "bf\n");
  731.  
  732. // change to a better weapon if appropriate
  733.  
  734.     if ( other.weapon == best )
  735.     {
  736.         stemp = self;
  737.         self = other;
  738.         self.weapon = W_BestWeapon();
  739.         W_SetCurrentAmmo ();
  740.         self = stemp;
  741.     }
  742.  
  743. // if changed current ammo, update it
  744.     stemp = self;
  745.     self = other;
  746.     W_SetCurrentAmmo();
  747.     self = stemp;
  748.  
  749. // remove it in single player, or setup for respawning in deathmatch
  750.     self.model = string_null;
  751.     self.solid = SOLID_NOT;
  752.     if (deathmatch == 1 || deathmatch == 3)
  753.         self.nextthink = time + 30;
  754.     self.think = SUB_regen;
  755.  
  756.     activator = other;
  757.     SUB_UseTargets();                // fire all targets / killtargets
  758. };
  759.  
  760.  
  761.  
  762.  
  763. float WEAPON_BIG2 = 1;
  764.  
  765. /*QUAKED item_shells (0 .5 .8) (0 0 0) (32 32 32) big
  766. */
  767.  
  768. void() item_shells =
  769. {
  770.     self.touch = ammo_touch;
  771.  
  772.     if (self.spawnflags & WEAPON_BIG2)
  773.     {
  774.         precache_model ("maps/b_shell1.bsp");
  775.         setmodel (self, "maps/b_shell1.bsp");
  776.         self.aflag = 40;
  777.     }
  778.     else
  779.     {
  780.         precache_model ("maps/b_shell0.bsp");
  781.         setmodel (self, "maps/b_shell0.bsp");
  782.         self.aflag = 20;
  783.     }
  784.     self.weapon = 1;
  785.     self.netname = "shells";
  786.     setsize (self, '0 0 0', '32 32 56');
  787.     StartItem ();
  788. };
  789.  
  790. /*QUAKED item_spikes (0 .5 .8) (0 0 0) (32 32 32) big
  791. */
  792.  
  793. void() item_spikes =
  794. {
  795.     self.touch = ammo_touch;
  796.  
  797.     if (self.spawnflags & WEAPON_BIG2)
  798.     {
  799.         precache_model ("maps/b_nail1.bsp");
  800.         setmodel (self, "maps/b_nail1.bsp");
  801.         self.aflag = 50;
  802.     }
  803.     else
  804.     {
  805.         precache_model ("maps/b_nail0.bsp");
  806.         setmodel (self, "maps/b_nail0.bsp");
  807.         self.aflag = 25;
  808.     }
  809.     self.weapon = 2;
  810.     self.netname = "nails";
  811.     setsize (self, '0 0 0', '32 32 56');
  812.     StartItem ();
  813. };
  814.  
  815. /*QUAKED item_rockets (0 .5 .8) (0 0 0) (32 32 32) big
  816. */
  817.  
  818. void() item_rockets =
  819. {
  820.     self.touch = ammo_touch;
  821.  
  822.     if (self.spawnflags & WEAPON_BIG2)
  823.     {
  824.         precache_model ("maps/b_rock1.bsp");
  825.         setmodel (self, "maps/b_rock1.bsp");
  826.         self.aflag = 10;
  827.     }
  828.     else
  829.     {
  830.         precache_model ("maps/b_rock0.bsp");
  831.         setmodel (self, "maps/b_rock0.bsp");
  832.         self.aflag = 5;
  833.     }
  834.     self.weapon = 3;
  835.     self.netname = "rockets";
  836.     setsize (self, '0 0 0', '32 32 56');
  837.     StartItem ();
  838. };
  839.  
  840.  
  841. /*QUAKED item_cells (0 .5 .8) (0 0 0) (32 32 32) big
  842. */
  843.  
  844. void() item_cells =
  845. {
  846.     self.touch = ammo_touch;
  847.  
  848.     if (self.spawnflags & WEAPON_BIG2)
  849.     {
  850.         precache_model ("maps/b_batt1.bsp");
  851.         setmodel (self, "maps/b_batt1.bsp");
  852.         self.aflag = 12;
  853.     }
  854.     else
  855.     {
  856.         precache_model ("maps/b_batt0.bsp");
  857.         setmodel (self, "maps/b_batt0.bsp");
  858.         self.aflag = 6;
  859.     }
  860.     self.weapon = 4;
  861.     self.netname = "cells";
  862.     setsize (self, '0 0 0', '32 32 56');
  863.     StartItem ();
  864. };
  865.  
  866.  
  867. /*QUAKED item_weapon (0 .5 .8) (0 0 0) (32 32 32) shotgun rocket spikes big
  868. DO NOT USE THIS!!!! IT WILL BE REMOVED!
  869. */
  870.  
  871. float WEAPON_SHOTGUN = 1;
  872. float WEAPON_ROCKET = 2;
  873. float WEAPON_SPIKES = 4;
  874. float WEAPON_BIG = 8;
  875. void() item_weapon =
  876. {
  877.     self.touch = ammo_touch;
  878.  
  879.     if (self.spawnflags & WEAPON_SHOTGUN)
  880.     {
  881.         if (self.spawnflags & WEAPON_BIG)
  882.         {
  883.             precache_model ("maps/b_shell1.bsp");
  884.             setmodel (self, "maps/b_shell1.bsp");
  885.             self.aflag = 40;
  886.         }
  887.         else
  888.         {
  889.             precache_model ("maps/b_shell0.bsp");
  890.             setmodel (self, "maps/b_shell0.bsp");
  891.             self.aflag = 20;
  892.         }
  893.         self.weapon = 1;
  894.         self.netname = "shells";
  895.     }
  896.  
  897.     if (self.spawnflags & WEAPON_SPIKES)
  898.     {
  899.         if (self.spawnflags & WEAPON_BIG)
  900.         {
  901.             precache_model ("maps/b_nail1.bsp");
  902.             setmodel (self, "maps/b_nail1.bsp");
  903.             self.aflag = 40;
  904.         }
  905.         else
  906.         {
  907.             precache_model ("maps/b_nail0.bsp");
  908.             setmodel (self, "maps/b_nail0.bsp");
  909.             self.aflag = 20;
  910.         }
  911.         self.weapon = 2;
  912.         self.netname = "spikes";
  913.     }
  914.  
  915.     if (self.spawnflags & WEAPON_ROCKET)
  916.     {
  917.         if (self.spawnflags & WEAPON_BIG)
  918.         {
  919.             precache_model ("maps/b_rock1.bsp");
  920.             setmodel (self, "maps/b_rock1.bsp");
  921.             self.aflag = 10;
  922.         }
  923.         else
  924.         {
  925.             precache_model ("maps/b_rock0.bsp");
  926.             setmodel (self, "maps/b_rock0.bsp");
  927.             self.aflag = 5;
  928.         }
  929.         self.weapon = 3;
  930.         self.netname = "rockets";
  931.     }
  932.     
  933.     setsize (self, '0 0 0', '32 32 56');
  934.     StartItem ();
  935. };
  936.  
  937.  
  938. /*
  939. ===============================================================================
  940.  
  941. KEYS
  942.  
  943. ===============================================================================
  944. */
  945.  
  946. void() key_touch =
  947. {
  948. local entity    stemp;
  949. local float        best;
  950.  
  951.     if (other.classname != "player")
  952.         return;
  953.     if (other.health <= 0)
  954.         return;
  955.     if (other.items & self.items)
  956.         return;
  957.  
  958.     sprint (other, "You got the ");
  959.     sprint (other, self.netname);
  960.     sprint (other,"\n");
  961.  
  962.     playsound (other, CHAN_ITEM, self.noise, 1, ATTN_NORM);
  963.     stuffcmd (other, "bf\n");
  964.     other.items = other.items | self.items;
  965.  
  966.     if (!coop)
  967.     {    
  968.         self.solid = SOLID_NOT;
  969.         self.model = string_null;
  970.     }
  971.  
  972.     activator = other;
  973.     SUB_UseTargets();                // fire all targets / killtargets
  974. };
  975.  
  976.  
  977. void() key_setsounds =
  978. {
  979.     if (world.worldtype == 0)
  980.     {
  981.         precache_sound ("misc/medkey.wav");
  982.         self.noise = "misc/medkey.wav";
  983.     }
  984.     if (world.worldtype == 1)
  985.     {
  986.         precache_sound ("misc/runekey.wav");
  987.         self.noise = "misc/runekey.wav";
  988.     }
  989.     if (world.worldtype == 2)
  990.     {
  991.         precache_sound2 ("misc/basekey.wav");
  992.         self.noise = "misc/basekey.wav";
  993.     }
  994. };
  995.  
  996. /*QUAKED item_key1 (0 .5 .8) (-16 -16 -24) (16 16 32)
  997. SILVER key
  998. In order for keys to work
  999. you MUST set your maps
  1000. worldtype to one of the
  1001. following:
  1002. 0: medieval
  1003. 1: metal
  1004. 2: base
  1005. */
  1006.  
  1007. void() item_key1 =
  1008. {
  1009.     if (world.worldtype == 0)
  1010.     {
  1011.         precache_model ("progs/w_s_key.mdl");
  1012.         setmodel (self, "progs/w_s_key.mdl");
  1013.         self.netname = "silver key";
  1014.     }
  1015.     else if (world.worldtype == 1)
  1016.     {
  1017.         precache_model ("progs/m_s_key.mdl");
  1018.         setmodel (self, "progs/m_s_key.mdl");
  1019.         self.netname = "silver runekey";
  1020.     }
  1021.     else if (world.worldtype == 2)
  1022.     {
  1023.         precache_model2 ("progs/b_s_key.mdl");
  1024.         setmodel (self, "progs/b_s_key.mdl");
  1025.         self.netname = "silver keycard";
  1026.     }
  1027.     key_setsounds();
  1028.     self.touch = key_touch;
  1029.     self.items = IT_KEY1;
  1030.     setsize (self, '-16 -16 -24', '16 16 32');
  1031.     StartItem ();
  1032. };
  1033.  
  1034. /*QUAKED item_key2 (0 .5 .8) (-16 -16 -24) (16 16 32)
  1035. GOLD key
  1036. In order for keys to work
  1037. you MUST set your maps
  1038. worldtype to one of the
  1039. following:
  1040. 0: medieval
  1041. 1: metal
  1042. 2: base
  1043. */
  1044.  
  1045. void() item_key2 =
  1046. {
  1047.     if (world.worldtype == 0)
  1048.     {
  1049.         precache_model ("progs/w_g_key.mdl");
  1050.         setmodel (self, "progs/w_g_key.mdl");
  1051.         self.netname = "gold key";
  1052.     }
  1053.     if (world.worldtype == 1)
  1054.     {
  1055.         precache_model ("progs/m_g_key.mdl");
  1056.         setmodel (self, "progs/m_g_key.mdl");
  1057.         self.netname = "gold runekey";
  1058.     }
  1059.     if (world.worldtype == 2)
  1060.     {
  1061.         precache_model2 ("progs/b_g_key.mdl");
  1062.         setmodel (self, "progs/b_g_key.mdl");
  1063.         self.netname = "gold keycard";
  1064.     }
  1065.     key_setsounds();
  1066.     self.touch = key_touch;
  1067.     self.items = IT_KEY2;
  1068.     setsize (self, '-16 -16 -24', '16 16 32');
  1069.     StartItem ();
  1070. };
  1071.  
  1072.  
  1073.  
  1074. /*
  1075. ===============================================================================
  1076.  
  1077. END OF LEVEL RUNES
  1078.  
  1079. ===============================================================================
  1080. */
  1081.  
  1082. void() sigil_touch =
  1083. {
  1084. local entity    stemp;
  1085. local float        best;
  1086.  
  1087.     if (other.classname != "player")
  1088.         return;
  1089.     if (other.health <= 0)
  1090.         return;
  1091.  
  1092.     centerprint (other, "You got the rune!");
  1093.  
  1094.     playsound (other, CHAN_ITEM, self.noise, 1, ATTN_NORM);
  1095.     stuffcmd (other, "bf\n");
  1096.     self.solid = SOLID_NOT;
  1097.     self.model = string_null;
  1098.     serverflags = serverflags | (self.spawnflags & 15);
  1099.     self.classname = "";        // so rune doors won't find it
  1100.     
  1101.     activator = other;
  1102.     SUB_UseTargets();                // fire all targets / killtargets
  1103. };
  1104.  
  1105.  
  1106. /*QUAKED item_sigil (0 .5 .8) (-16 -16 -24) (16 16 32) E1 E2 E3 E4
  1107. End of level sigil, pick up to end episode and return to jrstart.
  1108. */
  1109.  
  1110. void() item_sigil =
  1111. {
  1112.     if (!self.spawnflags)
  1113.         objerror ("no spawnflags");
  1114.  
  1115.     precache_sound ("misc/runekey.wav");
  1116.     self.noise = "misc/runekey.wav";
  1117.  
  1118.     if (self.spawnflags & 1)
  1119.     {
  1120.         precache_model ("progs/end1.mdl");
  1121.         setmodel (self, "progs/end1.mdl");
  1122.     }
  1123.     if (self.spawnflags & 2)
  1124.     {
  1125.         precache_model2 ("progs/end2.mdl");
  1126.         setmodel (self, "progs/end2.mdl");
  1127.     }
  1128.     if (self.spawnflags & 4)
  1129.     {
  1130.         precache_model2 ("progs/end3.mdl");
  1131.         setmodel (self, "progs/end3.mdl");
  1132.     }
  1133.     if (self.spawnflags & 8)
  1134.     {
  1135.         precache_model2 ("progs/end4.mdl");
  1136.         setmodel (self, "progs/end4.mdl");
  1137.     }
  1138.     
  1139.     self.touch = sigil_touch;
  1140.     setsize (self, '-16 -16 -24', '16 16 32');
  1141.     StartItem ();
  1142. };
  1143.  
  1144. /*
  1145. ===============================================================================
  1146.  
  1147. POWERUPS
  1148.  
  1149. ===============================================================================
  1150. */
  1151.  
  1152. void() powerup_touch;
  1153.  
  1154.  
  1155. void() powerup_touch =
  1156. {
  1157. local entity    stemp;
  1158. local float        best;
  1159.  
  1160.     if (other.classname != "player")
  1161.         return;
  1162.     if (other.health <= 0)
  1163.         return;
  1164.  
  1165.     sprint (other, "You got the ");
  1166.     sprint (other, self.netname);
  1167.     sprint (other,"\n");
  1168.  
  1169.     if (deathmatch)
  1170.     {
  1171.         self.mdl = self.model;
  1172.         
  1173.         if ((self.classname == "item_artifact_invulnerability") ||
  1174.             (self.classname == "item_artifact_invisibility"))
  1175.             self.nextthink = time + 60*5;
  1176.         else
  1177.             self.nextthink = time + 60;
  1178.         
  1179.         self.think = SUB_regen;
  1180.     }    
  1181.  
  1182.     playsound (other, CHAN_VOICE, self.noise, 1, ATTN_NORM);
  1183.     stuffcmd (other, "bf\n");
  1184.     self.solid = SOLID_NOT;
  1185.     other.items = other.items | self.items;
  1186.     self.model = string_null;
  1187.  
  1188. // do the apropriate action
  1189.     if (self.classname == "item_artifact_envirosuit")
  1190.     {
  1191.         other.rad_time = 1;
  1192.         other.radsuit_finished = time + 30;
  1193.     }
  1194.     
  1195.     if (self.classname == "item_artifact_invulnerability")
  1196.     {
  1197.         other.invincible_time = 1;
  1198.         other.invincible_finished = time + 30;
  1199.     }
  1200.     
  1201.     if (self.classname == "item_artifact_invisibility")
  1202.     {
  1203.         other.invisible_time = 1;
  1204.         other.invisible_finished = time + 30;
  1205.     }
  1206.  
  1207.     if (self.classname == "item_artifact_super_damage")
  1208.     {
  1209.         other.super_time = 1;
  1210.         other.super_damage_finished = time + 30;
  1211.     }    
  1212.  
  1213.     activator = other;
  1214.     SUB_UseTargets();                // fire all targets / killtargets
  1215. };
  1216.  
  1217.  
  1218.  
  1219. /*QUAKED item_artifact_invulnerability (0 .5 .8) (-16 -16 -24) (16 16 32)
  1220. Player is invulnerable for 30 seconds
  1221. */
  1222. void() item_artifact_invulnerability =
  1223. {
  1224.     return;
  1225.     self.touch = powerup_touch;
  1226.  
  1227.     precache_model ("progs/invulner.mdl");
  1228.     precache_sound ("items/protect.wav");
  1229.     precache_sound ("items/protect2.wav");
  1230.     precache_sound ("items/protect3.wav");
  1231.     self.noise = "items/protect.wav";
  1232.     setmodel (self, "progs/invulner.mdl");
  1233.     self.netname = "Pentagram of Protection";
  1234.     self.items = IT_INVULNERABILITY;
  1235.     setsize (self, '-16 -16 -24', '16 16 32');
  1236.     StartItem ();
  1237. };
  1238.  
  1239. /*QUAKED item_artifact_envirosuit (0 .5 .8) (-16 -16 -24) (16 16 32)
  1240. Player takes no damage from water or slime for 30 seconds
  1241. */
  1242. void() item_artifact_envirosuit =
  1243. {
  1244.     self.touch = powerup_touch;
  1245.  
  1246.     precache_model ("progs/suit.mdl");
  1247.     precache_sound ("items/suit.wav");
  1248.     precache_sound ("items/suit2.wav");
  1249.     self.noise = "items/suit.wav";
  1250.     setmodel (self, "progs/suit.mdl");
  1251.     self.netname = "Biosuit";
  1252.     self.items = IT_SUIT;
  1253.     setsize (self, '-16 -16 -24', '16 16 32');
  1254.     StartItem ();
  1255. };
  1256.  
  1257.  
  1258. /*QUAKED item_artifact_invisibility (0 .5 .8) (-16 -16 -24) (16 16 32)
  1259. Player is invisible for 30 seconds
  1260. */
  1261. void() item_artifact_invisibility =
  1262. {
  1263.     self.touch = powerup_touch;
  1264.  
  1265.     precache_model ("progs/invisibl.mdl");
  1266.     precache_sound ("items/inv1.wav");
  1267.     precache_sound ("items/inv2.wav");
  1268.     precache_sound ("items/inv3.wav");
  1269.     self.noise = "items/inv1.wav";
  1270.     setmodel (self, "progs/invisibl.mdl");
  1271.     self.netname = "Ring of Shadows";
  1272.     self.items = IT_INVISIBILITY;
  1273.     setsize (self, '-16 -16 -24', '16 16 32');
  1274.     StartItem ();
  1275. };
  1276.  
  1277.  
  1278. /*QUAKED item_artifact_super_damage (0 .5 .8) (-16 -16 -24) (16 16 32)
  1279. The next attack from the player will do 4x damage
  1280. */
  1281. void() item_artifact_super_damage =
  1282. {
  1283.     self.touch = powerup_touch;
  1284.  
  1285.     precache_model ("progs/quaddama.mdl");
  1286.     precache_sound ("items/damage.wav");
  1287.     precache_sound ("items/damage2.wav");
  1288.     precache_sound ("items/damage3.wav");
  1289.     self.noise = "items/damage.wav";
  1290.     setmodel (self, "progs/quaddama.mdl");
  1291.     self.netname = "Quad Damage";
  1292.     self.items = IT_QUAD;
  1293.     setsize (self, '-16 -16 -24', '16 16 32');
  1294.     StartItem ();
  1295. };
  1296.  
  1297.  
  1298.  
  1299. /*
  1300. ===============================================================================
  1301.  
  1302. PLAYER BACKPACKS
  1303.  
  1304. ===============================================================================
  1305. */
  1306.  
  1307. void() BackpackTouch =
  1308. {
  1309.     local string    s;
  1310.     local    float    best, old, new;
  1311.     local        entity    stemp;
  1312.     local    float    acount;
  1313.     
  1314.     if (other.classname != "player")
  1315.         return;
  1316.     if (other.health <= 0)
  1317.         return;
  1318.  
  1319.     //don't let self pick it up for a sec
  1320.     if ((other == self.owner) && ( (self.nextthink - time) > 118 ) )
  1321.         return;
  1322.  
  1323.     acount = 0;
  1324.     sprint (other, "You get ");
  1325.  
  1326.     if (self.items)
  1327.         if ((other.items & self.items) == 0)
  1328.         {
  1329.             acount = 1;
  1330.             sprint (other, "the ");
  1331.             sprint (other, self.netname);
  1332.         }
  1333.  
  1334. // if the player was using his best weapon, change up to the new one if better        
  1335.     stemp = self;
  1336.     self = other;
  1337.     best = W_BestWeapon();
  1338.     self = stemp;
  1339.  
  1340. // change weapons
  1341.     other.ammo_shells = other.ammo_shells + self.ammo_shells;
  1342.     other.ammo_nails = other.ammo_nails + self.ammo_nails;
  1343.     other.ammo_rockets = other.ammo_rockets + self.ammo_rockets;
  1344.     if (other.rune_num != ITEM_RUNE_POSEIDON)
  1345.         other.ammo_cells = other.ammo_cells + self.ammo_cells;
  1346.  
  1347.     new = self.items;
  1348.     if (!new)
  1349.         new = other.weapon;
  1350.     old = other.items;
  1351.     other.items = other.items | new;
  1352.     
  1353.     bound_other_ammo ();
  1354.  
  1355.     if (self.ammo_shells)
  1356.     {
  1357.         if (acount)
  1358.             sprint(other, ", ");
  1359.         acount = 1;
  1360.         s = ftos(self.ammo_shells);
  1361.         sprint (other, s);
  1362.         sprint (other, " shells");
  1363.     }
  1364.     if (self.ammo_nails)
  1365.     {
  1366.         if (acount)
  1367.             sprint(other, ", ");
  1368.         acount = 1;
  1369.         s = ftos(self.ammo_nails);
  1370.         sprint (other, s);
  1371.         sprint (other, " nails");
  1372.     }
  1373.     if (self.ammo_rockets)
  1374.     {
  1375.         if (acount)
  1376.             sprint(other, ", ");
  1377.         acount = 1;
  1378.         s = ftos(self.ammo_rockets);
  1379.         sprint (other, s);
  1380.         sprint (other, " rockets");
  1381.     }
  1382.     if (self.ammo_cells)
  1383.     {
  1384.         if (acount)
  1385.             sprint(other, ", ");
  1386.         acount = 1;
  1387.         s = ftos(self.ammo_cells);
  1388.         sprint (other, s);
  1389.         sprint (other, " cells");
  1390.     }
  1391.     
  1392.     sprint (other, "\n");
  1393. // backpack touch sound
  1394.     playsound (other, CHAN_ITEM, "weapons/lock4.wav", 1, ATTN_NORM);
  1395.     stuffcmd (other, "bf\n");
  1396.  
  1397. // remove the backpack, change self to the player
  1398.     remove(self);
  1399.     self = other;
  1400.  
  1401. // change to the weapon
  1402.     if (!deathmatch)
  1403.         self.weapon = new;
  1404.     else
  1405.         Deathmatch_Weapon (old, new);
  1406.  
  1407.     W_SetCurrentAmmo ();
  1408. };
  1409.  
  1410. /*
  1411. ===============
  1412. DropBackpack
  1413. ===============
  1414. */
  1415. void() DropBackpack =
  1416. {
  1417.     local entity    item;
  1418.  
  1419.     if (!(self.ammo_shells + self.ammo_nails + self.ammo_rockets + self.ammo_cells))
  1420.         return;    // nothing in it
  1421.  
  1422.     item = spawn();
  1423.     item.origin = self.origin - '0 0 24';
  1424.  
  1425.     item.items = 0; // none by default
  1426.  
  1427. //ZOID--axe and hook don't go into backpack
  1428.     if (self.weapon != IT_HOOK || self.weapon != IT_AXE)
  1429.         item.items = self.weapon;
  1430.  
  1431.     if (item.items == IT_SHOTGUN)
  1432.         item.netname = "Shotgun";
  1433.     else if (item.items == IT_SUPER_SHOTGUN)
  1434.         item.netname = "Double-barrelled Shotgun";
  1435.     else if (item.items == IT_NAILGUN)
  1436.         item.netname = "Nailgun";
  1437.     else if (item.items == IT_SUPER_NAILGUN)
  1438.         item.netname = "Super Nailgun";
  1439.     else if (item.items == IT_GRENADE_LAUNCHER)
  1440.         item.netname = "Grenade Launcher";
  1441.     else if (item.items == IT_ROCKET_LAUNCHER)
  1442.         item.netname = "Rocket Launcher";
  1443.     else if (item.items == IT_LIGHTNING)
  1444.         item.netname = "Thunderbolt";
  1445.     else
  1446.         item.netname = "";
  1447.  
  1448.     item.ammo_shells = self.ammo_shells;
  1449.     item.ammo_nails = self.ammo_nails;
  1450.     item.ammo_rockets = self.ammo_rockets;
  1451.     item.ammo_cells = self.ammo_cells;
  1452.  
  1453.     item.velocity_z = 300;
  1454.     item.velocity_x = -100 + (random() * 200);
  1455.     item.velocity_y = -100 + (random() * 200);
  1456.     
  1457.     item.flags = FL_ITEM;
  1458.     item.solid = SOLID_TRIGGER;
  1459.     item.movetype = MOVETYPE_TOSS;
  1460.     setmodel (item, "progs/backpack.mdl");
  1461.     setsize (item, '-16 -16 0', '16 16 56');
  1462.     item.touch = BackpackTouch;
  1463.     
  1464.     item.nextthink = time + 120;    // remove after 2 minutes
  1465.     item.think = SUB_Remove;
  1466. };
  1467.